﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>SafetySituation</title>
    <style>
        body {
            padding:0;
            margin:0;
            overflow:hidden;
        }
        #main {
            width: 100%;
            height: 100vh;
            background-repeat: no-repeat;
            padding:0;
            margin:0;
        }
        #currentTime {
            position:absolute;
            color:white;
            font-size:17px;
            font-family:黑体;
            right:50px;
            top:40px;
        }
    </style>
</head>
<body>
    <span id="currentTime">

    </span>
    <div id="main">

        <img src="../../Assets/img/safetychart.png" style="width:100%;" />
    </div>

    <script>
        function displayTime() {
            // 创建一个新的Date对象，它将自动设置为当前日期和时间
            var currentDate = new Date();

            // 格式化日期和时间
            var year = currentDate.getFullYear();
            var month = currentDate.getMonth() + 1; // getMonth() 是从0开始的，所以需要加1
            var day = currentDate.getDate();
            var hours = currentDate.getHours();
            var minutes = currentDate.getMinutes();
            var seconds = currentDate.getSeconds();

            // 确保月份、日期、小时、分钟和秒都是两位数
            month = month < 10 ? '0' + month : month;
            day = day < 10 ? '0' + day : day;
            hours = hours < 10 ? '0' + hours : hours;
            minutes = minutes < 10 ? '0' + minutes : minutes;
            seconds = seconds < 10 ? '0' + seconds : seconds;

            // 拼接日期和时间字符串
            var formattedTime = month + '月' + day + '日 ' + hours + ':' + minutes + ':' + seconds;

            // 更新HTML元素的内容
            document.getElementById('currentTime').textContent = formattedTime;
        }

        // 每秒调用一次displayTime函数
        setInterval(displayTime, 1000);

        // 首次显示当前时间
        displayTime();
    </script>
</body>
</html>
